package com.wondream.domain;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * @author wondream
 * @version 1.0
 * @create 2022/5/15 10:23 PM
 */
@Data
// indexName指定索引名称 type指定类型名称
@Document(indexName = "heima-sd", type = "article")
public class Article {

    @Id
    @Field(type = FieldType.Integer)
    private Integer id;

    /**
     * index 是否设置分词
     * analyzer 存储时使用的分词器
     * searchAnalyzer 搜索时使用的分词器
     * store 是否存储
     * type 数据类型
     */
    @Field(analyzer = "ik_smart", searchAnalyzer = "ik_smart", store = true, type = FieldType.String)
    private String title;
    @Field(analyzer = "ik_smart", searchAnalyzer = "ik_smart", store = true, type = FieldType.String)
    private String context;
    @Field(store = true, type = FieldType.Integer)
    private String hits;
}
